package com.yuanrui.interview.server.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanrui.interview.server.entity.po.InterviewQuestionHistory;
import com.yuanrui.interview.server.dao.InterviewQuestionHistoryDao;
import com.yuanrui.interview.server.service.InterviewQuestionHistoryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 面试题目记录表(InterviewQuestionHistory)表服务实现类
 *
 * @author makejava
 * @since 2024-07-30 19:30:53
 */
@Service("interviewQuestionHistoryService")
public class InterviewQuestionHistoryServiceImpl extends ServiceImpl<InterviewQuestionHistoryDao,InterviewQuestionHistory> implements InterviewQuestionHistoryService {
    @Resource
    private InterviewQuestionHistoryDao interviewQuestionHistoryDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public InterviewQuestionHistory queryById(Long id) {
        return this.interviewQuestionHistoryDao.queryById(id);
    }

    /**
     * 新增数据
     *
     * @param interviewQuestionHistory 实例对象
     * @return 实例对象
     */
    @Override
    public InterviewQuestionHistory insert(InterviewQuestionHistory interviewQuestionHistory) {
        this.interviewQuestionHistoryDao.insert(interviewQuestionHistory);
        return interviewQuestionHistory;
    }

    /**
     * 修改数据
     *
     * @param interviewQuestionHistory 实例对象
     * @return 实例对象
     */
    @Override
    public InterviewQuestionHistory update(InterviewQuestionHistory interviewQuestionHistory) {
        this.interviewQuestionHistoryDao.update(interviewQuestionHistory);
        return this.queryById(interviewQuestionHistory.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.interviewQuestionHistoryDao.deleteById(id) > 0;
    }
}
